Report the steady state in gdk_display_pointer_is_grabbed
authorAlexander Larsson <alexl@redhat.com>
Mon, 2 Feb 2009 14:37:02 +0000 (15:37 +0100)
committerAlexander Larsson <alex@localhost.localdomain>
Thu, 2 Apr 2009 08:15:30 +0000 (10:15 +0200)
For instance if we grab the pointer and then check if its grabbed
so that we know to ungrab we don't care that the grab is not
yet active, so report the steady state (i.e. the last grab)

gdk/gdkdisplay.c

index 74f08fc1704b965f519057d64739b3300b5c6099..d3cb8455ab87e1cfb36d6f58c282eb9617ad896e 100644 (file)
@@ -750,24 +750,6 @@ generate_grab_broken_event (GdkWindow *window,
     }
 }
 
-/* Get the pointer grab in effects for events we just sent */
-GdkPointerGrabInfo *
-_gdk_display_get_active_pointer_grab (GdkDisplay *display)
-{
-  GdkPointerGrabInfo *info;
-
-  if (display->pointer_grabs == NULL)
-    return NULL;
-
-  info = display->pointer_grabs->data;
-
-  if (info->activated)
-    return info;
-  
-  return NULL;
-}
-
-
 GdkPointerGrabInfo *
 _gdk_display_get_last_pointer_grab (GdkDisplay *display)
 {
@@ -1266,7 +1248,10 @@ gdk_pointer_grab_info_libgtk_only (GdkDisplay *display,
   
   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
 
-  info = _gdk_display_get_active_pointer_grab (display);
+  /* What we're interested in is the steady state (ie last grab),
+     because we're interested e.g. if we grabbed so that we
+     can ungrab, even if our grab is not active just yet. */
+  info = _gdk_display_get_last_pointer_grab (display);
   
   if (info)
     {
@@ -1299,7 +1284,10 @@ gdk_display_pointer_is_grabbed (GdkDisplay *display)
   
   g_return_val_if_fail (GDK_IS_DISPLAY (display), TRUE);
 
-  info = _gdk_display_get_active_pointer_grab (display);
+  /* What we're interested in is the steady state (ie last grab),
+     because we're interested e.g. if we grabbed so that we
+     can ungrab, even if our grab is not active just yet. */
+  info = _gdk_display_get_last_pointer_grab (display);
   
   return (info && !info->implicit);
 }